package com.isi.mtl.lf.jag.parameters;

import java.util.HashMap;

import com.isi.mtl.lf.jag.constantes.Units;

/**
 * 
 * @author Loic FALKLAND
 * @version 1.0
 *
 */

public class Parameter {

	private String from;
	private String to;
	private Boolean secure_transaction = false;
	private Boolean sensor = false;
	private Integer metric = Units.METRIC;
	private HashMap<Integer, String> unitsMapping;
	
	Parameter(){}

	/**
	 * 
	 * @param from starting point
	 * @param to destination point
	 */
	public Parameter(String from, String to) {
		this.from = from;
		this.to = to;
	}
	
	/**
	 * 
	 * @param from starting point
	 * @param to destination point
	 * @param secure_transaction indicates if you want a secure transaction (https / http)
	 * @param sensor indicate whether your application is using a sensor (such as a GPS locator) <br/><a href="https://developers.google.com/maps/documentation/" target="_blank">More information</a>
	 * @param metric depends on Unit constant
	 * 
	 */
	public Parameter(String from, String to, Boolean secure_transaction,
			Boolean sensor, Integer metric) {
		this.from = from;
		this.to = to;
		this.secure_transaction = secure_transaction;
		this.sensor = sensor;
		this.metric = metric;
	}
	
	/**
	 * 
	 * @param from starting point
	 * @param to destination point
	 * @param metric depends on Unit constant
	 * 
	 */
	public Parameter(String from, String to, Integer metric) {
		this.from = from;
		this.to = to;
		this.metric = metric;
	}

	/**
	 * 
	 * @param from starting point
	 * @param to destination point
	 * @param secure_transaction indicates if you want a secure transaction (https / http)
	 * 
	 */
	public Parameter(String from, String to, Boolean secure_transaction) {
		this.from = from;
		this.to = to;
		this.secure_transaction = secure_transaction;
	}
	
	/**
	 * 
	 * @param from starting point
	 * @param to destination point
	 * @param secure_transaction indicates if you want a secure transaction (https / http)
	 * @param sensor indicate whether your application is using a sensor (such as a GPS locator) <br/><a href="https://developers.google.com/maps/documentation/" target="_blank">More information</a><br/><b>Default : False</b>
	 * 
	 */
	public Parameter(String from, String to, Boolean secure_transaction,
			Boolean sensor) {
		this.from = from;
		this.to = to;
		this.secure_transaction = secure_transaction;
		this.sensor = sensor;
	}

	{
		
		//Unit�s mapping
		unitsMapping = new HashMap<Integer, String>();
		unitsMapping.put(Units.IMPERIAL, "imperial");
		unitsMapping.put(Units.METRIC, "metric");
		
	}
	
	//Getters / Setters
	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}
	
	public Boolean getSecure_transaction() {
		return secure_transaction;
	}

	public void setSecure_transaction(Boolean secure_transaction) {
		this.secure_transaction = secure_transaction;
	}

	public Boolean getSensor() {
		return sensor;
	}

	public void setSensor(Boolean sensor) {
		this.sensor = sensor;
	}
	
	public String getUnitChoosen(){
		return unitsMapping.get(metric);
	}

	public Integer getMetric() {
		return metric;
	}

	public void setMetric(Integer metric) {
		this.metric = metric;
	}

	public HashMap<Integer, String> getUnitsMapping() {
		return unitsMapping;
	}

	public void setUnitsMapping(HashMap<Integer, String> unitsMapping) {
		this.unitsMapping = unitsMapping;
	}

}
